<?php
require_once ("src/db/connectdatabase.php");

function getBankLoan($idloan, $bankid) {
	$con = new ConnectDB();
	$tbl = "banksloan";
	$fn = array('bankloan_id', 'dac_tinh_loan', 'object_dk_loan', 'thu_tuc_loan', 'bankid', 'bankname', 'banklogo');
	$fcon = array('loan_id' => $idloan, 'isavalible' => true);
	$flike = array('bankid' => $bankid);
	return $con -> getvalueall($tbl,$fn,$fcon,$flike,'datecreate');
}

function getIntroLoan($idloan) {
	$con = new ConnectDB();
	$tbl = "loans";
	$fn = array('intro_bank_loan_header');
	$condetion = array('loan_id' => $idloan);
	return $con -> getvalue($tbl, $fn, $condetion);
}
$bankid = "";
if(isset($_GET['bank'])) {
	$bankid = $_GET['bank'];
}

$idloan = "vay_ca_nhan";
$arrbankloan = getBankLoan($idloan, $bankid);
$arrintrobasic = getIntroLoan($idloan);
?>
<script type="text/javascript">
    document.title = "Tổng hợp ngân hàng vay tín chấp tiêu dùng hiện nay - Tài Chính Online";
</script>
<link rel="stylesheet" type="text/css" href="<?php echo($host) ?>css/layout.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo($host) ?>css/template.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo($host) ?>css/style.css"/>
<u><a href="http://taichinhonline.vn" class="text12" style="color: #0080d6;">Trang Chủ</a></u>&gt; <u><a href="<?php echo($host) ?>cho-vay-ca-nhan.html" class="text12" style="color: #0080d6;">Vay tín chấp</a></u>&gt; Tổ chức cho vay</span>
<script type="text/javascript" src="<?php echo($host) ?>js/jquery.js"></script>

<script type="text/javascript">
	$(document).ready(function(){
		$(".tabsms_container").each(function(){                    
			var parent = $(this).parent().attr("id");
			$(this).hide();                    
			$("#"+parent+" .tabsms_container:first").show();
			var parent_parent = $("#"+parent).parent().attr("id");
			$("#"+parent_parent+" ul.consultant_tab_header li:first").addClass("active");
			$("#"+parent_parent+" ul.consultant_tab_header li").click(function(){
				$("#"+parent_parent+" ul.consultant_tab_header li").removeClass("active"); //Remove any "active" class
				$(this).addClass("active"); //Add "active" class to selected tab
				$("#"+parent+" .tabsms_container").hide(); //Hide all tab content            
				var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
				$("#"+parent+" .tabsms_container"+activeTab).show(); //Fade in the active ID content
				return false;
			})
		});
	});
</script>
<div class="content">
<!-- Left content -->
	<div class="wrapper_left">
		<div>
		<?php 
            if(count($arrintrobasic) == 1) {
            ?><br /><iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Ffacebook.com%2Ftaichinhonline.vn&amp;width=450&amp;height=80&amp;colorscheme=light&amp;layout=standard&amp;action=like&amp;show_faces=true&amp;send=true" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:660px; height:25px;" allowTransparency="true"></iframe>
            <div class="text11" style="color: #4c4c4c; width: 100%; margin-left: 8px;"><?php echo($arrintrobasic[0][0]) ?></div>
            <?php
            }
            ?>
        </div>
        <div style="clear:both;"></div>
        
		<div class="sh_box prl_showlist">
			<div class="sh_title faq_infos_title">VAY TÍN CHẤP</div>
            <div><select name="selectbank" class="bankloadselect" id="selectbank" style="width: 185px; height: 26px;" onchange="submit_search_bankloan()"><option value="">--Chọn ngân hàng--</option></select></div>
			<div class="clear" style="margin-top: 10px;"><span></span></div>
        <?php
		for ($i = 0; $i < count($arrbankloan); $i++) {
		?>
        	<div id="parent<?php echo($i) ?>" class="product_item_content product_loan_item">
        		<div class="product_item_name">
					<div class="product_item_bankname">
						<a class="product_bank_img" title="<?php echo($arrbankloan[$i][5]) ?>" rel="nofollow">
							<img src="<?php echo($host) ?><?php echo($arrbankloan[$i][6]) ?>" class="product_bank_img" align="<?php echo($arrbankloan[$i][5]) ?>">
						</a>
						<!--<a class="product_bank_name" title="">Tên ngan hang</a>-->
                        <div><span style="margin-left: 4px; text-align:center;"><a href="<?php echo($host) ?>vay-tin-chap/ap-dung-cho-vay-ca-nhan/bank/<?php echo($arrbankloan[$i][4]) ?>.html"><img src="<?php echo($host) ?>images/dangky.png" /></a></span></div>
					</div>
				</div> 
				<div class="product_loan_tab"> 
					<span class="product_tab_title"><a href="#">VAY TÍN CHẤP</a></span>  
						<ul class="consultant_tab_header" id="cardinfo<?php echo($i) ?>">                 
							<li class="product_tab product_loan_t1 active"><a class="product_tab" href="#functions">Đặc tính</a></li>                
							<li class="product_tab product_loan_t2"><a class="product_tab" href="#condition">Đối tượng - điều kiện vay</a></li> 
							<li class="product_tab product_loan_t3"><a class="product_tab" href="#procedure">Thủ tục vay vốn</a></li> 
						</ul>    	
					</div>
					<div class="clear"></div>            	
					<div class="product_loan_tab_content" id="tabs<?php echo($i) ?>">
						<div style="display: block;" id="functions" class="tabsms_container"><?php echo($arrbankloan[$i][1]) ?></div>
                		<div style="display: none;" id="condition" class="tabsms_container"><?php echo($arrbankloan[$i][2]) ?></div>
						<div style="display: none;" id="procedure" class="tabsms_container"><?php echo($arrbankloan[$i][3]) ?></div>
					</div>
				<div class="product_content_link">
                	<a class="product_bank_name" style="float:left; color: #666;" title="<?php echo($arrbankloan[$i][5]) ?>"><?php echo($arrbankloan[$i][5]) ?></a>
                    <?php 
					$strbanknameurl = $arrbankloan[$i][5];
					$strbanknameurl = rewriteTextUrl(stripUnicode($strbanknameurl));
					?>
					<a href="<?php echo($host) ?>chi-tiet-ngan-hang-cho-vay/<?php echo($arrbankloan[$i][0]) ?>/<?php echo ($strbanknameurl); ?>.html" class="product_content_relate_consultant" style=" color: #666;" rel="nofollow">Xem chi tiết</a>
					<div class="clear"></div>
				</div>
			</div>
			<div class="clear"></div>
         <?php
		}
		 ?>
		</div>
		<div class="clear"></div>
	</div>
    <!-- Right content -->
    <div style="float: right; clear: right; background-image: url(<?php echo($host) ?>images/gray_bg.gif); width: 275px; height: auto; margin-top: 10px;">
        <?php include("formsendapplyloan.php"); ?>
   <img src="http://dl.vietdesigner.net/u/181257125/250x220.jpg" width="273" height="250" />
        <img src="http://dl.vietdesigner.net/u/181257125/250x220.jpg" width="273" height="250" />
    <div class="clear"></div>

</div>
<script>
loadbank();
function loadbank() {
	$.ajax({
		url: "<?php echo($host) ?>src/ajax/ajaxbank.php",
		type: "post",
		data: {act:'getbanks'},
		dataType:"json",
		success: function(response) {
			html = '';
			$.each(response, function(entryIndex, entry){
				html += '<option value="' + entry[0] + '">' + entry[1] + ' (' + entry[0] + ')</option>';
			});
			$('.bankloadselect').append(html);
			$('.bankloadselect').val('<?php echo($bankid) ?>');
		}
	});
}

function submit_search_bankloan() {
	window.location = "<?php echo($host) ?>vay-tin-chap/ngan-hang-cho-vay-ca-nhan/bank/" + $('.bankloadselect').val() + ".html";
}
    function FloatTopDiv()
    {
        startLX = ((document.body.clientWidth -MainContentW)/2)-LeftBannerW-LeftAdjust , startLY = TopAdjust+80;
        startRX = ((document.body.clientWidth -MainContentW)/2)+MainContentW+RightAdjust , startRY = TopAdjust+80;
        var d = document;
        function ml(id)
        {
            var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
            el.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';};
            el.x = startRX;
            el.y = startRY;
            return el;
        }
        function m2(id)
        {
            var e2=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
            e2.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';};
            e2.x = startLX;
            e2.y = startLY;
            return e2;
        }
        window.stayTopLeft=function()
        {
            if (document.documentElement && document.documentElement.scrollTop)
                var pY =  document.documentElement;
            else if (document.body)
                var pY =  document.body;
            if (document.body.scrollTop > 30){startLY = 3;startRY = 3;} else {startLY = TopAdjust;startRY = TopAdjust;};
            ftlObj.y += (pY+startRY-ftlObj.y)/16;
            ftlObj.sP(ftlObj.x, ftlObj.y);
            ftlObj2.y += (pY+startLY-ftlObj2.y)/16;
            ftlObj2.sP(ftlObj2.x, ftlObj2.y);
            setTimeout("stayTopLeft()", 1);
        }
        ftlObj = ml("divAdRight");
        //stayTopLeft();
        ftlObj2 = m2("divAdLeft");
        stayTopLeft();
    }
    function ShowAdDiv()
    {
        var objAdDivRight = document.getElementById("divAdRight");
        var objAdDivLeft = document.getElementById("divAdLeft");
        if (document.body.clientWidth < 1000)
        {
            objAdDivRight.style.display = "none";
            objAdDivLeft.style.display = "none";
        }
        else
        {
            objAdDivRight.style.display = "block";
            objAdDivLeft.style.display = "block";
            FloatTopDiv();
        }
    }
</script>
<script>
document.write("<script type='text/javascript' language='javascript'>MainContentW = 1000;LeftBannerW = 125;RightBannerW = 125;LeftAdjust = 5;RightAdjust = 5;TopAdjust = 10;ShowAdDiv();window.onresize=ShowAdDiv;;<\/script>");
</script>